import { reqsecklist } from "../../http/api"
//状态
let state = {
    list: []
}

//导出状态
let getters = {
    list(state) {
        return state.list
    }
}

//修改状态
let mutations = {
    changeList(state, list) {
        state.list = list
    }
}

//做逻辑 做异步
let actions = {
    //list逻辑
    reqList({ commit }) {
        reqsecklist().then(res => {
            if (res.data.code == 200) {
                // 给list赋值
                commit("changeList", res.data.list ? res.data.list : [])
            }
        })
    }
}


export default {
    state,
    getters,
    mutations,
    actions,
    //命名空间
    namespaced: true
}